using System;
using VirtualKeyboard.Contract;

namespace VirtualKeyboard.Service.Commands
{
    public sealed class KeyboardCommand : ICommand
    {
        private readonly IKeyBoardHook keyBoardHook;

        public KeyboardCommand(IKeyBoardHook keyBoardHook)
        {
            this.keyBoardHook = keyBoardHook;
        }

        public string Package
        {
            get { return KeyMethods.KeyboardPackage; }
        }

        public void Press(string method)
        {
            Keys key;
            bool success = Enum.TryParse(method, false, out key);
            if (success)
            {
                keyBoardHook.PressKey(key);
            }
        }
    }
}